import java.util.ArrayList;
import java.util.Collection;


public class ProperActualParams {
	Expression exp;
	ProperActualParams2 pap2;
	int lineNum;
	int charPos;
	
	public ProperActualParams ( Expression exp, ProperActualParams2 pap2, int line, int charP){
		this.exp = exp;
		this.pap2 = pap2;
		this.lineNum = line;
		this.charPos = charP;
	}
	public String toString(){
		String ret = "";

		String s = "";
		if (exp != null) {
			s += exp.toString();
		}
		if (pap2 != null) {
			s +=  pap2.toString();
		}
		
		return ret+s;
	}
	public void check(int x, String id) throws SemanticException {
		SymbolTable table = SymbolTable.getInstance();
		if (exp != null) {
			Collection<Entry> ce = table.st.values();
			ArrayList<Type> ls = new ArrayList<Type>();
			for(Entry e: ce){
				if(e.parent != null && e.parent.equals(id)){
					ls.add(e.type);
				}
			}
					
			
			exp.check(ls.get(ls.size()-x-1));
		}
		if (pap2 != null) {
			//System.out.println("ProperActualParams 2");
			pap2.check(x+1, id);
		}
	}
}
